/*

*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		long long n,r;
		scanf("%lld %lld",&n,&r);
		long long ans;
		if(r==1) 
		{
			printf("1\n");
			continue;
		}
		if(n<=r) ans = n*(n-1)/2+1;
		else if(n>r) ans = r*(1+r)/2;
		printf("%lld\n",ans);
	}
}
